package com.example.xutildemoproject.base;

import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import com.xuexiang.xutil.tip.ToastUtils;

import butterknife.ButterKnife;
import butterknife.Unbinder;

public abstract class BaseActivity extends AppCompatActivity {
    private Unbinder unbinder;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        checkPermission();
        unbinder = ButterKnife.bind(this);
        initArgs();
        initViews();
        initListeners();

    }

    @LayoutRes
    protected abstract int getLayoutId();

    protected abstract void initArgs();

    protected abstract void initViews();

    protected abstract void initListeners();

    @Override
    protected void onDestroy() {
        unbinder.unbind();
        super.onDestroy();
    }
    protected void toast(String msg){
        ToastUtils.toast(msg);
    }

    /**
     * 检查拍照权限
     */
    private void checkPermission() {

    }
}
